﻿@model GPS.ENTITYS.ViewModelDKH_LH
@using PagedList.Mvc;
@using GPS.Helpers;
@{
    ViewBag.Title = "Lịch học";
}

<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/datepicker.js"></script>


<script>
    $(document).ready(function () {
        // load district by province when change in dropdownlist
        $("#DVGTVT_MA_dll").change(function () {
            $.ajax({
                url: '@Url.Action("getKH_MAs", "GPS_LichHoc")',
                type: 'post',
                data: {
                    ma_DVGT: $('#DVGTVT_MA_dll').val()
                }
            }).done(function (response) {
                // update district by province
                var a = '<option value></option>' + response;   // defaut value
                $("#KH_MA_dll").html(a);

            });
        });



    });
</script>



<div class="container fdb-div-content fdb-div-corner-all">
    <h3 class="text-center fdb-title-search-form">Theo dõi quản lý tiến độ đào tạo</h3>
    <div class="row">

        @using (Html.BeginForm("Index", "GPS_LichHoc", FormMethod.Get))
        {
            <div class="list-group">
                <fieldset class="fs_body">
                    <legend class="head_title">Điều Kiện Tìm Kiếm</legend>
                    <div class="criteria_search">
                        <div class="row margin-top-05">
                            <div class="col-md-2 control-label">
                                Đơn vị đào tạo
                            </div>
                            <div class="col-md-4">
                                @Html.DropDownListFor(model => model.KH_LH_DVGTVT_MA, (SelectList)ViewBag.DVGTVT_MAs, "---Lựa chọn--", new { @class = "form-control", @id = "DVGTVT_MA_dll" })
                            </div>
                            <div class="col-md-2 control-label">
                                Khóa đào tạo
                            </div>
                            <div class="col-md-4">
                                @Html.DropDownListFor(model => model.KH_LH_KH_MA, (SelectList)ViewBag.KH_MAs, "---Lựa chọn--", new { @class = "form-control", @id = "KH_MA_dll" })
                            </div>
                        </div>

                        <div class="row margin-top-05">
                            <div class="col-md-2 control-label">
                                Giảng viên
                            </div>
                            <div class="col-md-4">
                                @*@Html.DropDownListFor(model => model.KH_LH_GV_MA, (SelectList)ViewBag.KH_LOP_GVs, "---Lựa chọn--", new { @class = "form-control", @id = "KH_GV_MA_dll" })*@

                                @Html.TextBoxFor(model => model.KH_LH_GV_MA, new { @class = "form-control" })
                            </div>
                            <div class="col-md-2 control-label">
                                Phương tiện
                            </div>
                            <div class="col-md-4">
                                @*@Html.DropDownListFor(model => model.KH_LH_PT_BIENSO, (SelectList)ViewBag.PT_MAs, "---Lựa chọn--", new { @class = "form-control", @id = "PT_MA_dll" })*@
                                @Html.TextBoxFor(model => model.KH_LH_PT_BIENSO, new { @class = "form-control" })
                            </div>
                        </div>

                        <div class="row margin-top-05">

                            <div class="col-md-2 control-label">
                                Hạng đào tạo
                            </div>
                            <div class="col-md-4">
                                @Html.DropDownListFor(model => model.HANGDT_MA, (SelectList)ViewBag.HANGDT_MAs, string.Empty, new { @class = "form-control", @id = "HANGDT_MA_dll" })
                            </div>
                        </div>

                    </div>

                    <div class="row margin-top-05 btn_search">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <span class="glyphicon glyphicon-search"></span> Tìm kiếm
                        </button>
                        @Html.NoEncodeActionLink("<span class='glyphicon glyphicon-plus'></span> Thêm mới", "Thêm mới", "Create", "GPS_LichHoc", null, htmlAttributes: new { @class = "btn btn-primary btn-sm" })

                    </div>
                </fieldset>
            </div>
        }

        <div class="row">
            <fieldset class="fs_body">
                <legend class="head_title">Kết quả tìm kiếm</legend>

                <div class="row margin-top-05">
                    <div class="divbtnFielset">
                        <div style="float: right;">
                            <label id="lblMessageTotal" style="color:blue; font-weight:bold">Tổng số bản ghi: @ViewBag.TotalRow</label>
                        </div>
                    </div>
                </div>

                <table class="table table-hover table-bordered table-condensed">
                    <tr>
                        <th>
                            STT
                        </th>
                        <th>
                            Mã khóa học
                        </th>
                        <th>
                            Biển số xe
                        </th>
                        <th>
                            Đơn vị GTVT
                        </th>
                        <th>
                            Tháng
                        </th>
                        <th>
                            Tuần
                        </th>
                        <th>
                            Từ ngày
                        </th>
                        <th>
                            Đến ngày
                        </th>
                        <th>
                            Giáo viên
                        </th>
                        <th>
                            Giai đoạn
                        </th>
                        <th>
                            Kiểm tra
                        </th>
                        <th>
                            Thao tác
                        </th>
                    </tr>
                    @{

                        if (Model.SearchResults != null)
                        {
                            int i = 0;
                            //var strDVGT_TEN = string.Empty;
                            //var strGV = string.Empty;
                            //GPS.DataAccessLayer.DbContextHelper<GPS.DataAccessLayer.GPS_NVContext> _db = GPS.COMMON.Singleton<GPS.DataAccessLayer.DbContextHelper<GPS.DataAccessLayer.GPS_NVContext>>.Inst;
                            foreach (var item in Model.SearchResults)
                            {
                                <tr>
                                    <td>
                                        @(i + 1)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.KH_LH_KH_MA)
                                    </td>
                                    <td>
                                        <a href="@Url.Action("HocVienPhuongTien", "GPS_LichHoc", new { id = item.ID, id2 = HttpUtility.HtmlEncode(item.KH_LH_PT_BIENSO) })" data-modal="" title="Click vào để xem danh sách học viên">
                                            @*<img src="@Url.Content("~/fonts/grid-view-icon.png")" title="Xem chi tiết" />*@
                                            @item.KH_LH_PT_BIENSO
                                        </a>
                                    </td>
                                    <td>

                                        @Html.DisplayFor(modelItem => item.DVGTVT_TEN)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.KH_LH_THANG)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.KH_LH_TUAN)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.KH_LH_TUNGAY)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.KH_LH_DENNGAY)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.GV_HOTEN)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.KH_LH_GDOAN_MA)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.KH_LH_KIEMTRA)
                                    </td>
                                    <td>
                                        <div class="pull-right">
                                            @*<a href="@Url.Action("_Detail", "GPS_LichHoc", new { id = item.KH_LOP_LH_MA })" data-modal="">
                                                    <img src="@Url.Content("~/fonts/grid-view-icon.png")" title="Xem chi tiết" />
                                                </a>*@
                                            <a href="@Url.Action("Edit", "GPS_LichHoc", new { id=item.ID })">
                                                <img src="@Url.Content("~/fonts/grid-edit-icon.png")" title="Sửa" />
                                            </a>

                                            <a href="@Url.Action("Delete", "GPS_LichHoc", new { id = item.ID })">
                                                <img src="@Url.Content("~/fonts/grid-delete-icon1.gif")" title="Xóa lịch học" onclick="return confirm('Bạn chắc chắn muốn xóa không?');" />
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                i++;
                            }
                        }
                    }

                </table>
                <div class="pagination-sm">
                    @Html.PagedListPager(Model.SearchResults, page => Url.Action("Index", new
                       {
                           page,
                           Model.KH_LH_DVGTVT_MA,
                           Model.KH_LH_KH_MA,
                           Model.KH_LH_GV_MA,
                           Model.KH_LH_PT_BIENSO,
                           Model.HANGDT_MA
                       }))
                </div>
            </fieldset>
        </div>
    </div>
</div>

<!-- delete modal placeholder-->
<div id='deleteModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='deleteModalContent'></div>
        </div>
    </div>
</div>

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/modalform")
}




